<template>
    <div class="main">
        <section>
            <div class="block-header"><div>红冲失败通知配置</div></div>
            <div>
                <el-form class="section-content" :model="invoiceSetting" :rules="commonRules"  size="medium" ref="form"  label-width="200px">
                   <el-form-item label="手机号：" prop="value" :rules="commonRules.notNullRule">
                        <el-input placeholder="请输入手机号，多个用逗号(英文状态下)隔开" type="textarea"  v-model="invoiceSetting.value"></el-input>
                    </el-form-item>
                </el-form>
            </div>
             <div class="footer-block">
                <el-button type="primary" @click="save">确定</el-button>
            </div>
        </section>
    </div>
</template>
<script>
export default {
    data() {
        return {
            invoiceSetting:{
                // desc:'红冲失败通知配置',
                // id:'',
                // key:'invoice.wash_fail.notice',
                // operator:this.$store.getters.user.realname,
                value:'',
                invoiceSetting: 'INVOICE_WASH_FAIL_NOTICE',
                operator:this.$store.getters.user.realname,
            }
        }
    },
    mounted() {
      this.getInitData()
    },
    methods: {
      getInitData() {
        this.request({
          url: '/invoice-web-manage/invoice/setting/getWashFailNotice',
          method: 'post',
        }).then((res) => {
          if (res.data){
            this.invoiceSetting.value = res.data
          }
        }).catch(err => {
          console.log(err)
        })
      },
        save() {
            this.$refs.form.validate(valid => {
                if (!valid) {
                    return false
                }
                this.request({
                    url: '/invoice-web-manage/invoice/setting/save',
                    method: 'post',
                    data:this.invoiceSetting
                }).then((res) => {
                    console.log(res)
                    if(res.code===200) {
                        this.$message.success('红冲失败通知配置成功！')
                    } else {
                        this.$message.console.error('红冲失败通知配置失败！')
                    }
                }).catch(err => {
                    console.log(err)

                })
            })
        }
    }
}
</script>
<style  lang="scss" scoped>
    .block-header{
        color: #1ea0ff;
        font-size: 14px;
        padding: 12px 0;
        margin-bottom: 12px;
        background: #f7f7f7;
        &>div{
            padding: 0 12px;
            border-left: 2px solid #1ea0ff;
        }
    }
    .footer-block{
        margin-left: 200px;
    }
</style>
